class_name TierIcon
extends TextureRect

# ===============================================

@export var stats: UnitStats :
	set(value):
		if stats == value:
			return
		stats = value
		if stats == null:
			return
		stats.changed.connect(__on_stats_changed)
		__on_stats_changed()

# ===============================================

func __on_stats_changed() -> void:
	texture = TIER_ICONS[stats.tier - 1]

# ===============================================

const TIER_ICONS: Array[Resource] = [
	preload("res://assets/images/level1.png"),
	preload("res://assets/images/level2.png"),
	preload("res://assets/images/level3.png"),
]
